package com.md.mod.utils;

/**
 *
 */
public enum StatusUtils {

    OK(1,"ok","成功"),NO(9,"no","失败"),HTTP500(500,"500","失败"),HTTP400(400,"400",""),HTTP200(200,"200",""),HTTP404(404,"404","");

    private int index;

    private String value;

    private String desc;


    StatusUtils() {
    }

    StatusUtils(int index, String value,String desc) {
        this.index = index;
        this.value = value;
        this.desc = desc;
    }
    /**
     * 获取中文说明
     * @param index
     * @return
     */
    public static String getValue (int index) {
        for (StatusUtils i:StatusUtils.values()) {
            if (i.index == index) {
                return i.value;
            }
        }
        return "";
    }

    /**
     * 获取描述
     * @param index
     * @return
     */
    public static String getDesc (int index) {
        for (StatusUtils i:StatusUtils.values()) {
            if (i.index == index) {
                return i.desc;
            }
        }
        return "";
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    @Override
    public String toString() {
        return "StatusUtils{" +
                "index=" + index +
                ", value='" + value + '\'' +
                '}';
    }
}
